package com.yisoo.ubag.product.controller;


import com.yisoo.common.to.CheckDeviceIsOpenTo;
import com.yisoo.common.to.RefreshBagStatusTo;
import com.yisoo.common.utils.R;
import com.yisoo.ubag.product.entity.DevEntity;
import com.yisoo.ubag.product.service.DevService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("feign")
public class AllFeignController {
    @Autowired
    private DevService devService;


    //根据创建者id获取设备id的list
    @GetMapping("/get/dev/byuid/{uid}")
    List<DevEntity> getDevByUid(@PathVariable("uid")Long uid){
        return  devService.getDevByUid(uid);
    }

    //激活设备 0->1
    @GetMapping("/active/{devname}/{status}")
    R activeDev(@PathVariable("devname") String devName, @PathVariable("status") Integer status){
        return  devService.activeDev(devName,status);
    }

    @RequestMapping("/get/rel/{devid}")
    RefreshBagStatusTo getRel(@PathVariable("devid") Long  devid){
        return devService.getRel(devid);
    }
}
